package main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;


public class IOOperations {
	
	public static Integer readStatus(){
		
		String s = "";
		try {
			BufferedReader in = new BufferedReader(new FileReader("D:\\Temp\\datos.dat"));
			s = in.readLine();
			in.close();
			
		} catch (Exception e) {
			System.out.println("Archivo dat no encontrado. Creando uno nuevo...");
		}
		return Integer.parseInt(s);
	}
	
	
	public static void saveStatus(Integer i){
		
		try {
			FileWriter fw = new FileWriter(new File("D:\\Temp\\datos.dat"));
			String s = i.toString();
			fw.write(s);
			fw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	public static String leerEntrada() {
		
		String salida = "";
		try{

			BufferedReader leerEntrada = new BufferedReader(new InputStreamReader(System.in));
			salida = leerEntrada.readLine();
			
		} catch( IOException e) {
			System.err.println("Error: " + e.getMessage());
		}
			return salida; 
	}
	
	
	
	
	
	
	
	
	public static void main(String[] args){
		//saveStatus(29);
		//readStatus();
		
	}

}
